$(document).ready(function() {
	var validataPass = function(){
		var text = $("#password");
		var message = Helper.validata.validataPass(text.val());
		if(message) {
			$(text).nextAll("span:last").html("<b class='aqxx_bg gantan_ico mr_2'></b>"+message).removeClass("gray").addClass("red");
			return false;
		}
		$(text).nextAll("span:last").html("").removeClass("red").addClass("gray");
		return true;
	};
	$("#password").blur(validataPass);
	$("#password").focus(function() {
		$(this).nextAll("span:last").html("请输入原账号密码").removeClass("red").addClass("gray");
	});
	
	var remoteTrans = new Helper.RemoteTrans({
		url:Helper.basePath+"/bundingAPILogin.htm",
		successRediectUrl:Helper.basePath+"/member_operate/goMemberPage/userinfo.htm",
		onSuccess:function(json){
//			location.href=Helper.basePath+"/member_operate/goMemberPage/userinfo.htm?tab=shareBindingLink";
//			var obj = new Helper.Window({
//					id:"binding_api_login_success",
//					title:"恭喜您绑定成功",
//					width:490,
//				    height:340,
//					url:Helper.basePath+"/page/expresslogin/sub/login_api_bangding_success.jsp",
//					onSuccess:function(){
//						this.close();
//					 }});
//			obj.show();
		},
		onError:function(json){
			Helper.message(json.message);
		}
	});
	
	$("#subfrm").click(function(){
		$(this).blur();
		if(validataPass()) {
			remoteTrans.addParameters("password",$("#password").val());
			remoteTrans.send();
		}
	});
});